/**
 *@Title: DeliveryQualityControl.java  
* @author: 胡彪
* @date: 2013-6-11 下午12:19:50
* @Description:
* @version: V1.0   
 */
package com.imonsoft.sqm.web.business.supplier_quality;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.imonsoft.common.exception.SystemException;
import com.imonsoft.common.httpModel.DataGrid;
import com.imonsoft.common.httpModel.Pager;
import com.imonsoft.common.util.AjaxUtil;
import com.imonsoft.common.util.DateUtil;
import com.imonsoft.common.util.JsonUtil;
import com.imonsoft.sqm.service.business.supplier_quality.DeliveryQualityService;
import com.imonsoft.sqm.vo.business.supplier_quality.DeliveryQualityVo;


/**
 *
 *
 */
@Controller
@RequestMapping("/business/supplier_quality/delivery_quality")
public class DeliveryQualityControl {

	
	protected final Log logger = LogFactory.getLog(getClass());
	
	@Autowired
	private DeliveryQualityService deliveryQualityService;
	
	@RequestMapping("/listUI.do")
	public void listUI(ModelMap model) {
		model.put("year", DateUtil.getNowDate().substring(0, 4));
	}
	
	
	@RequestMapping(value = "/ajaxList.do", method = RequestMethod.POST)
	public void ajaxList(HttpServletResponse response, Pager pager,DeliveryQualityVo deliveryQualityVo) { 

		   DataGrid<DeliveryQualityVo> dataGrid = new DataGrid<DeliveryQualityVo>();
		try {
			dataGrid=deliveryQualityService.getDataGridVoBy(deliveryQualityVo, pager);
		} catch (SystemException se) {
			se.printStackTrace();
			logger.debug(se.getMessage());
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(e.getMessage());
		} 
		  AjaxUtil.renderJSON(response, JsonUtil.bean2json(dataGrid));
	}
	
}
